function p=mafit2(t,P,L,m)
x=t;
y=log(L-P)-log(P);
format short;
T=zeros(m+1,m+1);
for i=0:m
    for j=0:m
        T(i+1,j+1)=sum(x.^(i+j));
    end
    b(i+1)=sum(x.^i.*y);
end
a=T\b';
p=fliplr(a');
A=a(2,1)
C=exp(a(1,1))
end
